package com.wuseguang.springcloud.controller;


import com.wuseguang.springcloud.Filter.RequestParameterWrapper;
import com.wuseguang.springcloud.service.AttendanceNoticeService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 学生考勤通知 前端控制器 （小程序应用）
 * </p>
 *
 * @author 
 * @since 2020-03-02
 */
@RestController
@RequestMapping("/jurisdiction")
public class AttendanceNoticeController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private AttendanceNoticeService attendanceNoticeServiceImpl;
    /**
     * 查询考勤通知(教师端)
     * @return
     */
    @RequestMapping("/findAttendanceNotice")
    public Result findAttendanceNotice(RequestParameterWrapper request ,
                                       @RequestParam(value = "classId",required = false)String [] classId,
                                       @RequestParam(value = "indexNo",required = false,defaultValue = "1")Integer indexNo,
                                       @RequestParam(value = "rows",required = false,defaultValue = "20")Integer rows){
        logger.info("查询考勤通知 findAttendanceNotice classId = {}",classId);
        //学校id
        String schoolId = request.getParam("schoolId");
        //教师id
        String teacherId = request.getParam("teacherId");
        return attendanceNoticeServiceImpl.findAttendanceNotice(classId,indexNo,rows,schoolId,teacherId);
    }

    /**
     * 查询班级班牌通知（教师端）
     * @return
     */
    @RequestMapping("/findClassNotice")
    public Result findClassNotice(RequestParameterWrapper request ,
                                  @RequestParam(value = "classId",required = false)String [] classId,
                                  @RequestParam(value = "indexNo",required = false,defaultValue = "1")Integer indexNo,
                                  @RequestParam(value = "rows",required = false,defaultValue = "20")Integer rows){
        logger.info("查询班级班牌通知  findClassNotice classId = {}",classId);
        //学校id
        String schoolId = request.getParam("schoolId");
        //教师id
        String teacherId = request.getParam("teacherId");
        return attendanceNoticeServiceImpl.findClassNotice(classId,indexNo,rows,schoolId,teacherId);
    }
}

